#include<iostream>
#include "listalinsinl.h"
using std::cout;

template<class T>LLSI<T>::LLSI(){
  (*this).p=NULL;
}
template<class T>LLSI<T>::~LLSI(){
	delete p;
}      
template<class T>void LLSI<T>::add(T info){
  Nod<T>* nou=new Nod<T>();
  nou->info=info;
  nou->urm=NULL;
  Nod<T>*r=(*this).p;
  if(r!=NULL)
  {
   while(r->urm!=NULL)
  	r=r->urm;
	  r->urm=nou;
  }
  else
   (*this).p=nou;    
}
template<class T>void LLSI<T>::listare()const{
  Nod<T>*r;
  r=(*this).p;
	while(r!=NULL)
	{
   cout<<"\n"<<r->info;
	 r=r->urm;
	}
}
template<class T>int LLSI<T>::dim()const{
  Nod<T>*r;
  r=(*this).p;
	int x=0;
	while(r!=NULL)
	{
	  r=r->urm;
	 	x++;
	}
	return x;
}
template<class T>void LLSI<T>::suprimare(T inf){
  Nod<T>*r=(*this).p;
	Nod<T>*temp;
  if(r->urm==NULL)
	{
  	(*this).p=NULL;
	  delete r;
	}
	else
	{
	 for(;r->info!=inf;r=r->urm)
	 {
		 temp=r;
	 }
	temp->urm=r->urm;
	delete r;			
	}
}
